#pragma once
#include<iostream>
#include<string>

using namespace std;

#define Change(v)(struct sockaddr*)(v)
#define Die(code) do{exit(code);}while(0)

enum
{
    SCOKET_ERR=1,
    BIND_ERR,
    USAGE_ERR
};


bool separate(const string&str,string*key,string*value,const string& sep)
{
    auto pos=str.find(sep); 
    if(pos==string::npos) return false;
    *key=str.substr(0,pos);
    *value=str.substr(pos+sep.size());
    if(key->empty()||value->empty()) return false;
    return true;
}